const { defineConfig } = require("@vue/cli-service")
const path = require("path")

module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    proxy: {
      "/api": {
        target: "https://thunders.com.hk/website/",
        pathRewrite: {
          "^/api": "",
        },
        changeOrigin: true,
      },
    },
  },
  publicPath: "/",
  pluginOptions: {
    "style-resources-loader": {
      preProcessor: "less",
      patterns: [
        path.resolve(__dirname, "./src/assets/css/var.less"), //这里的路径不能使用 @ 符号，否则会报错
      ],
    },
  },
  configureWebpack: {
    resolve: {
      alias: {
        "@": path.resolve(__dirname, "src"),
        "@images": path.resolve(__dirname, "src/assets/images"),
        "@cmpts": path.resolve(__dirname, "src/components"),
        "@page": path.resolve(__dirname, "src/views"),
      },
      extensions: [".js", ".vue", ".less", ".css"],
    },
    devtool: "source-map", // 启用 source map
  },
  css: {
    loaderOptions: {
      less: {},
    },
  },
})
